import { request } from '../../../services/request';

// 获取点检任务记录
export const getDeviceSpotRecord = async (params: {
    current: number;
    size: number;
    room_id_list: string[];
    state_list: number[];
    keyword?: string;
}) => {
    try {
        const requestBody = {
            current: params.current || 1,
            size: params.size || 10,
            room_id_list: params.room_id_list || [],
            state_list: params.state_list || [],
            keyword: params.keyword || '',
        };

        // console.log('点检任务请求数据:', requestBody);
        const response = await request('/app/appDeviceInfo/searchDeviceSpotPlan', {
            method: 'POST',
            body: JSON.stringify(requestBody),
        });
        // console.log('点检任务返回:', response);
        return response;
    } catch (error) {
        console.error('获取点检任务记录失败:', error);
        throw error;
    }
};

// 获取车间列表
export const getAllRoomApi = async () => {
    const res = await request('/app/appCommon/getAllRoom', {
        method: 'POST',
        body: JSON.stringify({}),
    });
    // console.log('getAllRoom接口返回（车间下拉）:', res);
    return res;
}; 